package routes

import (
	"github.com/gin-gonic/gin"
	"message-queue_0826/api/handler"
	"message-queue_0826/api/middleware"
)

func LoadRouter(r *gin.Engine) {

	api := r.Group("/api")
	{
		api.POST("sendSms", handler.SendSms)
		user := api.Group("/user")
		{
			user.POST("loginOrRegister", handler.LoginOrRegisterUser)
		}

	}
	queue := r.Group("/queue")
	{
		queue.POST("add", handler.AddQueue)
		queue.POST("addPublish", handler.AddPublishQueue)
	}

	auth := r.Group("/auth")
	{
		auth.Use(middleware.Auth())
		auth.POST("/addContact", handler.AddContact)
	}

	go handler.ChatManage.Start()
	r.GET("/chat", handler.CharMessage)

	/*r.GET("/", func(c *gin.Context) {
		c.String(http.StatusOK, "hello World!")
	})*/

}
